#ifndef IO_AUDIO_SOUNDMANAGER_H
#define IO_AUDIO_SOUNDMANAGER_H

#include "CSfx.h"
#include "Interfaces/IUpdatable.h"
#include "Irrlicht.h"

class SoundManager : public IUpdatable
{
private:
	CSfx *m_sfx;
	CSfx *m_music;

	float m_globalVolumeGain;

	SoundManager();
	~SoundManager();

public:
	static inline SoundManager &getInstance();

	void playSfx(int sfxId, bool isStatic = false, bool loop = false);
	void stopSfx(int sfxId);
	void stopAllSfx();

	void playMusic(int musicId, bool isStatic = false, bool loop = false);
	void stopMusic(int musicId);
	void stopAllMusic();

	CTrackStereo *getTrack(gameloft::audio::SfxFile track);

	float getGlobalVolumeGain() const { return m_globalVolumeGain; }

	void setListenerPos(const irr::core::vector3df &pos,
	                    const irr::core::vector3df &front,
	                    const irr::core::vector3df &up) const;

	void update(TimeStamp timestamp);
};

// inline methods
SoundManager&
SoundManager::getInstance()
{
	static SoundManager at;
	return at;
}

#endif /* IO_AUDIO_SOUNDMANAGER_H */